import $http from '../common/axiosConfig.js'
// 接口地址
const BASE_PATH = '../'

const $get = (url, params) => $http(BASE_PATH + url, params)
const $post = (url, params) => $http(BASE_PATH + url, params, 'POST')
const $upload = (url, params) => $http(BASE_PATH + url, params, 'POST', 'json', {'Content-Type': 'multipart/form-data; charset=UTF-8'})
const $download = (url, params) => $http(BASE_PATH + url, params, 'POST', 'blob')

export default {
  // 用户登录
  login: params => $post('/login/login', params),
  // 查询用户列表
  userLoadPage: params => $post('sys/user/loadPage', params),






  /** 登录登出**/
  // 用户登录
  // login: params => $post('/login/auth', params),
  // 获取用户信息
  getUserInfo: params => $post('/login/getInfo', {}),
  // 登出
  logout: params => $post('/login/logout', {}),
  // 获取验证码
  getCheckCode: params => $get('/login/getCheckCode', params),
  test: params => $download('/api/caisx/b2b/finance/salarySharing/downloadTemplate', params),

  /** 用户和权限**/
  // 获取用户列表
  getUserList: params => $post('/user/getUserList', params),
  // 关联用户下拉框用
  queryUserList: params => $get('/user/queryUserList', params),
  // 根据类型查询
  getUserListByType: params => $get('/user/getUserListByType', params),
  // 获取全部角色
  getAllRoles: params => $get('/user/getAllRoles'),
  // 根据角色类型查询角色列表
  getRoleListByType: params => $get('/sysRole/getRoleListByType', params),
  // 创建用户
  addUser: params => $post('/user/addUser', params),
  // 修改用户
  updateUser: params => $post('/user/updateUser', params),
  // 删除用户
  deleteUser: params => $get('/user/deleteUser/' + params),
  // 查询用户
  selectByIdSysUser: params => $get('/user/selectById', params),
  // 获得角色列表
  getRoleList: params => $get('/user/listRole', params),
  // 根据机构id查询下级内部角色列表
  getRoleListByOrg: params => $get('/sysRole/getRoleListByOrg', params),
  // 获得全部权限
  getAllPermission: params => $get('/user/getAllPermission'),
  // 创建角色
  addRole: params => $post('/user/addRole', params),
  // 修改角色
  updateRole: params => $post('/user/updateRole', params),
  // 删除角色
  deleteRole: params => $post('/user/deleteRole/' + params),
  // 查询数据字典
  queryCodes: params => $post('/sysCode/queryCodes'),
  // 查询角色列表
  queryRoles: params => $post('/sysRole/queryList', params),
  // 文件上传地址
  uploadFile: `${BASE_PATH}/uploadFile/uploadFile`,
  /** 用户和权限**/
  // 机构列表(树) 筛选查询
  getOrgList: params => $get('/user/listOrganization', params),
  // 全部机构tree
  queryOrgAllListTree: params => $get('/organization/queryOrgAllListTree', params),
  // 全部机构list
  queryOrgAllList: params => $get('/organization/queryOrgAllList', params),
  // 查询机构tree 筛选查询
  queryOrgTreeList: params => $post('/organization/queryList', params),
  // 创建机构
  addOrg: params => $post('/user/addOrganization', params),
  // 修改机构
  updateOrg: params => $post('/user/updateOrganization', params),
  // 删除机构
  deleteOrg: params => $post('/user/deleteOrganization/' + params),
  // 查询当前用户所属机构及下级机构id
  getCurUserOrg: params => $post('/organization/getDwChindNodes/' + params),
  // 查询当前用户所属机构及下级机构
  getChildOrgs: params => $get('/organization/getChildOrgs', params),
  // 根据类型查询当前用户所属机构及下级机构
  getChildOrgListByType: params => $get('/organization/getChildOrgListByType', params),
  // 根据类型当前用户所属机构及下级机构tree
  getChildOrgTreeByType: params => $get('/organization/getChildOrgTreeByType', params),
  // 查询当前用户所属机构及下级机构 树
  getChildOrgTree: params => $post('/organization/getChildOrgTree', params),

  // 查询部门列表tree
  queryDepartmentList: params => $post('/sysDepartment/queryList', params),
  // 新增部门
  addDepartment: params => $post('/sysDepartment/addDepartment', params),
  // 修改部门
  updateDepartment: params => $post('/sysDepartment/updateDepartment', params),
  // 删除部门
  deleteDepartment: params => $post('/sysDepartment/deleteDepartment/' + params),
  // 根据公司id查询及其下级部门列表tree
  getTreeByOrg: params => $get('/sysDepartment/getTreeByOrg', params),

  // 数据字典
  querySysCodeList: params => $post('/sysCode/queryList', params),
  deleteSysCodeList: params => $post('/sysCode/delete', params),
  detailSysCode: params => $get('/sysCode/detail', params),
  saveSysCode: params => $post('/sysCode/save', params),

  // 角色
  querySysRoleList: params => $post('/sysRole/queryList', params),
  deleteSysRoleList: params => $post('/sysRole/delete', params),
  detailSysRole: params => $get('/sysRole/detail', params),
  saveSysRoleInfo: params => $post('/sysRole/save', params),

  // 菜单树列表
  getMenuList: params => $get('/user/listMenu', params),
  // 创建菜单
  addMenu: params => $post('/user/addMenu', params),
  // 修改菜单
  updateMenu: params => $post('/user/updateMenu', params),
  // 删除菜单
  deleteMenu: params => $post('/user/deleteMenu/' + params),

  // 菜单按钮基础信息
  queryPermission: params => $get('/sysMenu/queryPermission', params),

  querySysMenu: params => $get('/sysMenu/sysMenuList', params),

  addSysMenu: params => $post('/sysMenu/addSysMenu', params),

  updateSysMenu: params => $post('/sysMenu/updateSysMenu', params),

  queryFunction: params => $get('/sysMenu/queryFunction', params),

  getMenuButtonBase: params => $get('/sysMenu/queryFunction', params),

  // 调度确认详情
  dispatcherDetail: params => $get('/sdWaybill/dispatcherDetail', params),
  // 财务收款列表导出excel
  transactionListExport: params => $download('/crmTransaction/queryTransactionListExport', params),

  importJsonXq: `${BASE_PATH}/DemandDataManagement/importJson`,
}
